<template>
	<view class="content">
		<view class="subject">
			<view class="bg">
				<view class="title">
					<text class="top">定金退款申请</text>
					<view class="text" @click="show = true">
						<text>使用帮助</text>
						<image src="../../static/icon/1_03.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="box-count">
				<view class="cont">
					<view class="item">
						<view class="left">
							<image src="../../static/icon/1_07.png" mode=""></image>
							<text>知识星球订单支付日期</text>
						</view>
						<view class="right" @click="show = true">
							<text>如何查看</text>
							<image src="../../static/icon/1_03.png" mode=""></image>
						</view>
					</view>
					<view class="inp" @click="openDatetimePicker">
						<u-input v-model="pay_at" placeholder='年 月 日 时 分，如：2024-03-01  12:05' />
					</view>
					<view class="item" style="margin-top: 68rpx;">
						<view class="left">
							<image src="../../static/icon/1_11.png" mode=""></image>
							<text>知识星球会员编码</text>
						</view>
						<view class="right" @click="show = true">
							<text>如何查看</text>
							<image src="../../static/icon/1_03.png" mode=""></image>
						</view>
					</view>
					<view class="inp">
						<u-input v-model="user_code" placeholder='请输入会员编号' />
					</view>
					<view class="item" style="margin-top: 68rpx;">
						<view class="left">
							<image src="../../static/icon/1_13.png" mode=""></image>
							<text>微信验证码</text>
						</view>
						<view class="right" @click="show = true">
							<text>如何查看</text>
							<image src="../../static/icon/1_03.png" mode=""></image>
						</view>
					</view>
					<view class="inp">
						<u-input v-model="wx_code" placeholder='请输入微信验证码' />
					</view>
					<view class="btn" @click="submit">
						申请退定金
					</view>
				</view>
				<image style="width: 679rpx;height: 155rpx;display: block;margin: 0 auto;" src="../../static/icon/1_17.png"
					mode="">
				</image>
			</view>

		</view>
		<u-popup :show="show" round="6" closeable @close="show = false">
			<view class="popup">
				<view class="title">
					<text class="top">使用帮助</text>
					<view class="text">
						<text>如何查看知识星球会员编号</text>
					</view>
				</view>
				<view class="vid">
					<video class="video" id="myVideo" src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"
						enable-danmu danmu-btn controls></video>
				</view>
				<view style="height: 100rpx;">
				</view>
			</view>
		</u-popup>
		<yt-dateTimePicker ref="myPicker" @submit="handleSubmit" :start-year="1949" :end-year="2099"
			:time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
	</view>
</template>

<script>
	import axios from 'axios'
	export default {
		data() {
			return {
				show: false,
				birthday: "",
				video: '',
				pay_at: '',
				user_code: '',
				wx_code: ''

			};
		},
		onShow() {

		},
		onLoad() {
			this.init()
		},
		methods: {
			submit() {
				let {
					pay_at,
					user_code,
					wx_code
				} = this
				if (!pay_at) this.$toast('请选择订单支付日期')
				if (!user_code) this.$toast('请输入会员编码')
				if (!wx_code) this.$toast('请输入微信验证码')
				let params = {
					pay_at,
					user_code,
					wx_code
				}
				uni.request({
					url: `https://e.s8jd.com/prod-api/api/mock/request?url=/api/zsxq/refund`, // 服务器地址
					method: 'GET', // 请求方式
					data: params,
					success: (res) => {
						console.log(res)
						this.pay_at = ''
						this.user_code = ''
						this.wx_code = ''
						this.$toast('提交成功')
					},
					fail: (err) => {
						console.log(err)
					}
				})
			},
			// 打开picker
			openDatetimePicker() {
				const timestamp = new Date().getTime(); // 获取当前时间戳
				// console.log(timestamp); // 输出时间戳
				this.$refs.myPicker.show();
			},

			// 关闭picker
			closeDatetimePicker() {
				this.$refs.myPicker.hide();
			},

			handleSubmit(e) {
				this.pay_at = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
			},

			init() {
				uni.request({
					url: `https://e.s8jd.com/prod-api/api/mock/request?url=/api/zsxq/getHelp`, // 服务器地址
					method: 'GET', // 请求方式
					success: (res) => {
						console.log(res)
						this.video = res.data
					},
					fail: (err) => {
						console.log(err)
					}
				})

			}
		},
	};
</script>

<style lang="scss" scoped>
	.content {
		.subject {
			position: relative;

			.bg {
				width: 750rpx;
				height: 420rpx;
				background: url("~@/static/bg1.png") no-repeat;
				background-size: 100% 100%;

				.title {
					padding-top: 126rpx;
					width: 311rpx;
					margin: 0 auto;

					.top {
						width: 311rpx;
						height: 49rpx;
						font-family: Microsoft YaHei;
						font-weight: bold;
						font-size: 50rpx;
						color: #171717;
					}

					.text {
						text-align: center;
						padding-top: 40rpx;

						text {
							width: 99rpx;
							height: 24rpx;
							font-family: Microsoft YaHei;
							font-weight: 400;
							font-size: 25rpx;
							color: #6C6C6C;
						}

						image {
							width: 25rpx;
							height: 25rpx;
							padding-left: 13rpx;
						}
					}
				}
			}

			.box-count {
				position: relative;
				top: -80rpx;
			}

			.cont {
				width: 681rpx;
				margin: 20px auto;

				background: #FFFFFF;
				box-shadow: 0rpx 0rpx 17rpx 0rpx rgba(38, 175, 164, 0.05);
				border-radius: 21rpx;
				padding: 43rpx 27rpx 70rpx 27rpx;

				.item {
					display: flex;
					justify-content: space-between;

					.left {
						display: flex;
						align-items: center;

						text {
							width: 288rpx;
							font-family: Microsoft YaHei;
							font-weight: bold;
							font-size: 28rpx;
							color: #171717;
							padding-left: 16rpx;
						}

						image {
							width: 30rpx;
							height: 30rpx;
						}
					}

					.right {
						display: flex;
						align-items: center;

						text {
							width: 100rpx;
							font-family: Microsoft YaHei;
							font-weight: 400;
							font-size: 25rpx;
							color: #6C6C6C;
							padding-right: 12rpx;
						}

						image {
							width: 25rpx;
							height: 25rpx;
						}
					}
				}

				.inp {
					width: 626rpx;
					margin-top: 33rpx;
				}

				.btn {
					width: 626rpx;
					line-height: 87rpx;
					background: linear-gradient(0deg, #16B998 0%, #31E6C1 100%);
					border-radius: 10rpx;
					margin-top: 70rpx;
					font-family: Microsoft YaHei;
					font-weight: 400;
					font-size: 33rpx;
					color: #FFFFFF;
					text-align: center;
				}


			}

		}

		.popup {
			.vid {
				width: 625rpx;
				height: 503rpx;
				margin: 0 auto;
				padding: 40rpx 0;

				.video {
					width: 625rpx;
					height: 503rpx;
				}
			}

			.title {
				padding-top: 60rpx;
				text-align: center;

				.top {
					width: 170rpx;
					height: 41rpx;
					font-family: Microsoft YaHei;
					font-weight: bold;
					font-size: 42rpx;
					color: #171717;
				}

				.text {
					text-align: center;
					padding-top: 40rpx;

					text {
						width: 99rpx;
						height: 24rpx;
						font-family: Microsoft YaHei;
						font-weight: 400;
						font-size: 25rpx;
						color: #6C6C6C;
					}
				}
			}
		}
	}
</style>